# encoding: utf8
from django import template
from django.contrib.humanize.templatetags.humanize import intcomma


register = template.Library()


@register.filter
def currency(value, symbol=u'€'):
    """Format a number as currency with the given currency symbol."""
    if not value:
        value = 0
    return u'%s%s' % (symbol, intcomma('%.2f' % value))

